﻿@{
    ViewBag.Title = "OpenAuth.net 测试页面";
}

<div class="jumbotron">
    <h1>OpenAuth.NET</h1>
    <p class="lead">这是OpenAuth.Net的测试站点，模拟一个第三方网站如何使用OpenAuth.net提供的权限功能！</p>
    <p>
        <a href="https://git.oschina.net/yubaolee/OpenAuth.Net" class="btn btn-default btn-lg">Learn more &raquo;</a>
    </p>
</div>

<div class="row">
    <div class="col-md-8">
        @if (ViewBag.CurrentUser != null)
            {
            <div class="media">
                <div class="media-body">
                    <h4 class="media-heading">@ViewBag.CurrentUser.User.Account ,您好！</h4>
                    <p>因为使用了SSO，所以您可以直接进入OpenAuth.Net，而不用重复登录</p>
                    <p>
                        <a href="/Home/Admin" class="btn btn-primary">直接进入OpenAuth.Net</a>
                        <a href="/login/logout" class="btn btn-danger">注销</a>
                    </p>
                </div>
            </div>
            
        }
    </div>
    <div class="col-md-4">
        @if (ViewBag.CurrentUser != null)
            {
            <h2>可访问的机构</h2>
                <ul>
                    @foreach (var org in ViewBag.CurrentUser.Orgs)
                {
                        <li>@org.Name</li>
                    }
                </ul>

                <h2>可访问的资源</h2>
                <ul>
                    @foreach (var resource in ViewBag.CurrentUser.Resources)
                {
                        <li>@resource.Name</li>
                    }
                </ul>
        }

    </div>
</div>